feat(M5d): ~> function-composition ($f ~> $g) + partial composition + T2006#17
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…se009/012) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
M5d adds the compose form of the
~>operator —$f ~> $g(when both sides are functions) → a new functionλ($x){ $g($f($x)) }— completing the~>operator (the apply formvalue ~> $funcalready shipped). This is the last M5 sub-milestone, closing out the function-signature /$eval/ composition arc.~>else path: evaluate the RHS; if it's not a function →T2006; if the LHS is also a function → compose by evaluating a memoizedchainASTmeta-lambda (function($f,$g){function($x){$g($f($x))}}) and applying it to{lhs, rhs}. The composed result is a real lambda, so it re-composes / curries under further~>for free.$g(?, x)) is detected by scanning for a?placeholder and routed through the existing partial machinery (it evaluates to a function value, then composes or single-applies). Delivers$substringAfter(?,"@") ~> $substringBefore(?,".").T2006—42 ~> "hello"now raises the jsonata error code (was T1006), via a sharedM.is_functionhelper that also backs the partial-application check.Results
function-applicationsgroup goes to 20/22 — the 6 compose cases (005, 009, 012, 015, 016, 017) flip green.Verification
An adversarial fidelity review against a jsonata-js v2.2.1 oracle confirmed compose order (g∘f), re-composition/currying, the
T2006boundary, partial-composition, and input-threading all match. The remainingfunction-applicationsfailures (case018 parser apply-chain form, case021 regex literals) are out of scope (M7).Test Plan
bustedfull unit suite — 428/428scripts/run-suite.sh— 1153/1682, zero regressions🤖 Generated with Claude Code